home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
macify13.shr
/
macify.hqx
/
Source
/
Macify Code
/
macify.c
< prev
next >
Wrap
Text File
|
1991-03-15
|
2KB
|
52 lines
/*************************************************************************
** **
** TM **
** Macify 1.0 **
** **
** By Donald Burr -- Copyright 1991 **
** **
** Released to the Public Domain **
** **
** Version History **
** **
** Date Version Comments **
** ---- ------- -------- **
** 15-Mar-91 1.0 Initial release. **
** Fixed file closure bug; it now properly **
** closes files when done with them. **
** **
*************************************************************************/
#include <stdio.h> /* Standard I/O functions */
#include <string.h> /* BSD uses strings.h */
#include "macify.h" /* defines for MACIFY */
void macify(thing_to_do, in, out) /* main Macify function */
int thing_to_do; /* what to do, what to do */
char *in, *out;
{
char the_input, the_output; /* input gathered from program */
char do_the_conversion(); /* this function does the stuff */
FILE *infile, *outfile, *fopen();
int fclose();
/* Assign filenames */
infile = fopen(in, "r"); /* open the file specified */
outfile = fopen(out, "w"); /* open for output */
/* Get input char-by-char */
while ((the_input = fgetc(infile)) != EOF) {
/* while we've still got stuff */
the_output = do_the_conversion(the_input, thing_to_do);
fputc(the_output, outfile);
/* Do the conversion */
}
putchar(BELL); /* Beep to let know of completion */
printf("\nMACIFY is complete. %s has been converted to %s.\n",
in, out);
fclose(infile);
fclose(outfile);
}